using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using ProductService.Domain.Models;

namespace ProductService.Application.Services
{
    /// <summary>
    /// 商品应用服务接口
    /// </summary>
    public interface IProductAppService
    {
        /// <summary>
        /// 获取商品
        /// </summary>
        /// <param name="id">商品ID</param>
        /// <returns>商品实体</returns>
        Task<Product> GetProductAsync(Guid id);
         
        /// <summary>
        /// 根据分类获取商品
        /// </summary>
        /// <param name="category">商品分类</param>
        /// <returns>商品列表</returns>
        Task<List<Product>> GetProductsByCategoryAsync(string category);

        /// <summary>
        /// 创建商品
        /// </summary>
        /// <param name="name">商品名称</param>
        /// <param name="description">商品描述</param>
        /// <param name="price">商品价格</param>
        /// <param name="stock">商品库存</param>
        /// <param name="category">商品分类</param>
        /// <returns>创建的商品ID</returns>
        Task<Guid> CreateProductAsync(string name, string description, decimal price, int stock, string category);

        /// <summary>
        /// 更新商品
        /// </summary>
        /// <param name="id">商品ID</param>
        /// <param name="name">商品名称（可选）</param>
        /// <param name="description">商品描述（可选）</param>
        /// <param name="price">商品价格（可选）</param>
        /// <param name="category">商品分类（可选）</param>
        Task UpdateProductAsync(Guid id, string name = null, string description = null, decimal? price = null, string category = null);

        /// <summary>
        /// 删除商品
        /// </summary>
        /// <param name="id">商品ID</param>
        Task DeleteProductAsync(Guid id);

        /// <summary>
        /// 减少商品库存
        /// </summary>
        /// <param name="id">商品ID</param>
        /// <param name="quantity">减少数量</param>
        Task ReduceStockAsync(Guid id, int quantity);

        /// <summary>
        /// 增加商品库存
        /// </summary>
        /// <param name="id">商品ID</param>
        /// <param name="quantity">增加数量</param>
        Task IncreaseStockAsync(Guid id, int quantity);

        /// <summary>
        /// 搜索商品
        /// </summary>
        /// <param name="keyword">搜索关键词</param>
        /// <returns>商品列表</returns>
        Task<List<Product>> SearchProductsAsync(string keyword);
    }
}